/**
 * @author Fang Lu, fanglupku@gmail.com
 * 2011-4-21
 */
package com.debugassistant.util;

import java.util.Comparator;

public class StringLengthComparator implements Comparator<String> {

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	@Override
	public int compare(String s1, String s2) {
		if (s1 == null && s2 == null) {
			return 0;
		} else if (s1 == null) {
			return -1;
		} else if (s2 == null) {
			return 1;
		} else {
			return s2.length() - s1.length();
		}
	}

}
